import { Cache } from "../../../cache/Cache";
import { PetExploreArea } from "./PetExploreArea";
import { PetExploreAreaConfig } from "../../../resource/PetExploreAreaConfig";
import { LoaderManager } from "../../../../../com/gengine/resource/LoaderManager";
import { PetExploreUtil } from "./info/PetExploreUtil";
import { SWFInfo } from "../../../../../com/gengine/resource/info/SWFInfo";
import { 95 } from "../../../../../304/95";
import { 95 } from "../../../../../173/95";
import { _pointOneArr } from "../../../../../this/_pointOneArr";
type int = number;
//class PetExploreMapPanel
    
    export  class PetExploreMapPanel /* flash.display.Sprite */
    {
        constructor()
        {
            this._areaArray = [];
            this._pointOneArr = [{"x": 0, "y": 0}, {"x": 297, "y": 0}, {"x": 217, "y": 99}, {"x": 0, "y": 210}, {"x": 342, "y": 240}];
            this._pointTwoArr = [{"x": 0, "y": 238}, {"x": 95, "y": 224}, {"x": 95, "y": 136}, {"x": 334, "y": 20}, {"x": 0, "y": 23}];
            
            this._exploredArea = Cache.instance.petExplore.getExploreAreaIndex();
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            var loc1=0;
            var loc2=0;
            var loc3=null;
            var loc4=0;
            this._bgBitmap = new Object /* flash.display.Bitmap */();
            this.addChild(this._bgBitmap);
            this._sp = new Object /* flash.display.Sprite */();
            this._sp.mouseEnabled = false;
            this.bgBitmapData = 0;
            var loc5=0;
            while (loc5 < this._pointOneArr.length) 
            {
                loc1 = this._pointOneArr[loc5].x;
                loc2 = this._pointOneArr[loc5].y;
                loc4 = loc5 + 1;
                loc3 = new PetExploreArea(loc4, this._sp);
                loc3.x = loc1;
                loc3.y = loc2;
                this.addChild(loc3);
                if (loc4 <= this._exploredArea) 
                {
                    loc3.isEnable = true;
                }
                else 
                {
                    loc3.isEnable = false;
                }
                loc3.areaConfig = PetExploreAreaConfig.instance.getAreaConfigByArea(loc4);
                this._areaArray.push(loc3);
                ++loc5;
            }
            this.addChild(this._sp);
            return;
        }

        /* internal  */set bgBitmapData(arg1: int)
        {
            var $value: int;

            var loc1;
            $value = arg1;
            LoaderManager.instance.load(PetExploreUtil.getMapBgImageName($value), (arg1: SWFInfo): void
            {
                _bgBitmap.bitmapData = arg1.bitmapData;
                return;
            })
            return;
        }

        public enableArea(arg1: int, arg2: Boolean): void
        {
            var loc1=this._areaArray[(arg1 - 1)];
            loc1.isEnable = arg2;
            return;
        }

        public set updataByPageTurning(arg1: int)
        {
            var loc1=null;
            var loc2=this._areaArray.length;
            var loc3=arg1 != 0 ? 6 : 1;
            var loc4=arg1 != 0 ? this._pointTwoArr : _pointOneArr;
            this.bgBitmapData = arg1;
            this._exploredArea = Cache.instance.petExplore.getExploreAreaIndex();
            var loc5=0;
            while (loc5 < loc2) 
            {
                loc1 = this._areaArray[loc5] as PetExploreArea;
                loc1.x = loc4[loc5].x;
                loc1.y = loc4[loc5].y;
                loc1.areaConfig = PetExploreAreaConfig.instance.getAreaConfigByArea(loc3);
                loc1.index = loc3;
                if (loc3 <= this._exploredArea) 
                {
                    loc1.isEnable = true;
                }
                else 
                {
                    loc1.isEnable = false;
                }
                loc1.setToolTipData();
                ++loc3;
                ++loc5;
            }
            return;
        }

        /* internal */ /* var */_bgBitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_areaArray: Array<any>;

        /* internal */ /* var */_pointOneArr: Array<any>;

        /* internal */ /* var */_pointTwoArr: Array<any>;

        /* internal */ /* var */_exploredArea: int;

        /* internal */ /* var */_sp: Object /* flash.display.Sprite */;
    }
